package main

import "fmt"

//利用快慢指针
func removeDuplicates(nums []int) int {
	j := 0
	for i := 0; i < len(nums); i++ {
		if nums[j] != nums[i] {
			nums[j] = nums[i]
			j++
		}
	}

	return j + 1
}

func main() {
	fmt.Println(removeDuplicates([]int{1, 1, 2}))
}
